import {_decorator, director, Label, Node} from 'cc';
import {UiDialog} from '../UiDialog';
import {UiManager} from "../../framework/manager/UiManager";
import {Constant} from "../../config/Constant";

const {ccclass, property} = _decorator;

@ccclass('UIShowTxt')
export class UIShowTxt extends UiDialog {
    @property(Node)
    titleNode: Node | null = null;
    @property(Node)
    contentNode: Node | null = null;

    titleString: string="提示"
    contentString: string="资源不足"

    //定义显示
    show() {
        this.titleNode.getComponent(Label).string = this.titleString
        this.contentNode.getComponent(Label).string = this.contentString
    }

    close() {
        if (director.isPaused()) {
            UiManager.instance.hideDialog(Constant.DIALOG_DEF.UIShowTxt);
        } else {
            UiManager.instance.showDialog(Constant.DIALOG_DEF.UIShowTxt);
        }
    }
}


